/*************************************************************************
	> File Name: toupper.c
	> Author: Angel Criss
	> Mail: abbytsing@gmail.com 
	> Created Time: Wed Aug  6 11:10:42 2014
 ************************************************************************/

#include<stdio.h>
#include<ctype.h>
#include<stdlib.h>
int main(int agrc,char *argv[])
{
    FILE *fp, *fout;
    int ch;

    if((fp=fopen(argv[1],"r"))==NULL)
    {
        fprintf(stderr,"cannot open file");
        exit(1);
    }

    if((fout=fopen(argv[2],"a+"))==NULL)
    {
        fprintf(stderr,"cannot open file");
        exit(1);
    }

    while((ch=getc(fp))!=EOF)
    {
        ch=toupper(ch);
        fwrite(&ch,sizeof(int),1,fout);
    }

    fclose(fp);
    fclose(fout);

    return 0;
}
